<crm-main-nav  nav-c="sales" page-title="个人销售计划"></crm-main-nav>
<!-- 面包屑 -->
<div class="container">
<ol class="breadcrumb">
    <li>CRM系统</li>
    <li>销售计划</li>
    <li class="active">个人销售计划</li>
</ol>
</div>
<!-- 内容 -->
<div ng-controller="salesPersonPlanController">
<div class="container">
<!-- 销售计划列表 -->
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">个人销售计划列表</h3>
  </div>
  <div class="panel-body">
    <form class="form-horizontal" role="form" ng-submit="searchSalesForm()">
        <div class="form-group">          
          <label class="col-sm-1 control-label">分公司：</label>
          <div class="col-sm-2">
            <company-select current-id="planList.branch_company_id"></company-select>
          </div>
          <label class="col-sm-1 control-label">计划月份：</label>
          <div  class="col-sm-2" date-input style-date="YYYY-MM" get-date="planList.month"></div>
          <div class="col-sm-1">
            <button type="submit" class="btn btn-primary"">搜索</button>
          </div>
        </div>
      </form>
    <table class="table table-bordered" id="table_list" ng-show="table_list.length>0">
        <thead>
          <tr>
            <th>分公司</th>
            <th>咨询师</th>
            <th>计划月份</th>
            <th>保底计划</th>
            <th>任务计划</th>
            <th>目标计划</th>
            <th>实际业绩金额</th>
            <th ng-if="user.type>=3">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr class="col" ng-repeat="v in currentData track by $index">
            <td>{{v.branch_company}}</td>
            <td>{{v.user_name}}</td>
            <td>{{v.month | date:'yyyy-MM'}}</td>
            <td>{{v.guarantee_planning}}</td>
            <td>{{v.task_planning}}</td>
            <td>{{v.target_planning}}</td>
            <td>{{v.reality_money}}</td>
            <td>
              <a href="javascript:void(0);" class="btn btn-default btn-sm" data-toggle="modal" data-target="#myModal" ng-click="setplan(v)">修改</a>
              <a href="javascript:void(0);" class="btn btn-default btn-sm" ng-click="delplan(v)">删除</a> 
            </td>
          </tr>
        </tbody>
        <tfoot>
        <tr>
          <td>小计</td>
          <td>-</td>
          <td>-</td>
          <td>{{sumData.guarantee_planning}}</td>
          <td>{{sumData.task_planning}}</td>
          <td>{{sumData.target_planning}}</td>
          <td>{{sumData.reality_money}}</td>
        </tr>
      </tfoot>
    </table>
  </div>
</div>
<!-- 翻页 -->
<div class="container">
    <pagination current-data="currentData" all-data="{{table_list}}"></pagination>
</div>
</div>
<!-- 模态框 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
      <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="myModalLabel">修改</h4>
          </div>
          <div class="modal-body">
            <form class="form-horizontal"  ng-submit="setForm()" id="set_form">
              <div class="form-group">
                <input type="hidden" ng-init="addSalesData.type=1">
                <label class="col-sm-2 control-label">分公司：</label>
                <div class="col-sm-4">
                  <company-select class="form-control" required current-id="setSalesData.branch_company_id"></company-select>
                </div>
                <label class="col-sm-2 control-label">计划月份：</label>
                <div class="col-sm-4" date-input style-date="YYYY-MM" get-date="setSalesData.month"></div>
              </div>  
              <div class="form-group">  
                <label class="col-sm-2 control-label">保底计划：</label>
                <div class="col-sm-3">
                  <input type='text' class="form-control" required ng-model="setSalesData.guarantee_planning"/>
                  </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">任务计划：</label>
                <div class="col-sm-4">
                  <input type='text' class="form-control" required ng-model="setSalesData.task_planning"/>
                </div>
                <label class="col-sm-2 control-label">目标计划：</label>
                <div class="col-sm-4">
                  <input type='text' class="form-control" required ng-model="setSalesData.target_planning"/>
                </div>
              </div>
            </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" ng-click="setForm()">确定</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          </div>
      </div>
  </div>
</div>
</div>